package com.zmn.oms.dubbo.impl.zmn.normal.order;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.common.utils.reflect.BeanMapper;
import com.zmn.oms.dubbo.dto.zmn.order.OrderDetailBindInfoDRO;
import com.zmn.oms.dubbo.interfaces.zmn.normal.order.OrderDetailListRemoteService;
import com.zmn.oms.dubbo.utils.DubboConsts;
import com.zmn.oms.model.entity.detail.OrderDetail;
import com.zmn.oms.services.interfaces.detail.OrderDetailService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.constants.LoadbalanceRules;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * @title: 查询小号绑定信息
 * @author:Rananquan
 * @date:2022/7/26 17:40
 */
@Slf4j
@DubboService(loadbalance = LoadbalanceRules.ROUND_ROBIN, timeout = 5000, retries = 5,version = DubboConsts.INTERFACE_VERSION, validation = "true")
public class OrderDetailListRemoteServiceImpl implements OrderDetailListRemoteService {

    @Resource
    private OrderDetailService orderDetailService;

    @Override
    public ResponseDTO<OrderDetailBindInfoDRO> getByDetailId(Long detailId) {
        OrderDetail orderDetail = orderDetailService.findOrderDetailByKey(detailId);

        OrderDetailBindInfoDRO orderDetailInfo = BeanMapper.map(orderDetail, OrderDetailBindInfoDRO.class);

        return ResponseDTO.success(orderDetailInfo);
    }
}
